package com.user.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.common.domain.Pages.PageResult;
import com.user.domain.dto.OperatePageParams;
import com.user.domain.pojo.UserOperateLogs;
import com.user.domain.vo.UserOperateLogVo;
import com.user.mapper.UserOperateLogsMapper;
import com.user.service.IUserOperateLogsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户操作日志表 服务实现类
 * </p>
 *
 * @author 小杰大人
 * @since 2025-02-28
 */
@Service
public class UserOperateLogsServiceImpl extends ServiceImpl<UserOperateLogsMapper, UserOperateLogs> implements IUserOperateLogsService {

    @Override
    public PageResult<UserOperateLogVo> pageOperateLogList(OperatePageParams operatePageParams) {
        long count = this.count();
        operatePageParams.setPageOn((operatePageParams.getPageOn() - 1) * operatePageParams.getPageSize());
        List<UserOperateLogVo> list = baseMapper.pageOperateLogList(operatePageParams.getPageOn(), operatePageParams.getPageSize(), operatePageParams.getKeyword(), operatePageParams.getStatus());
        return new PageResult<>(count, list);
    }

    @Override
    public UserOperateLogVo operateLogDetailById(Long id) {
        return baseMapper.getOperateLogDetailById(id);
    }
}
